import datetime
from applications.extensions import db

class Book(db.Model):
    __tablename__ = 'zbook_book'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(128))
    img = db.Column(db.String(255))
    desc = db.Column(db.String(512), default='', comment='介绍')
    covers = db.Column(db.String(255))
    sheets = db.Column(db.Integer)
    papers = db.Column(db.Integer)
    auth = db.Column(db.String(64))
    dynasty = db.Column(db.String(64))
    year = db.Column(db.String(64))
    status = db.Column(db.Integer)
    sort = db.Column(db.Integer, comment='排序')
    tid = db.Column(db.Integer, default=0, comment='主标签编号')
    tag = db.Column(db.String(64), default='', comment='主标签')
    uid = db.Column(db.Integer)
    views = db.Column(db.Integer, default=0, comment='观看次数')
    notes = db.Column(db.Integer, default=0, comment='笔记数')
    favs = db.Column(db.Integer, default=0, comment='收藏数')
    changed = db.Column(db.Integer, default=0, comment='修改数')
    update_time = db.Column(db.DateTime, default=datetime.datetime.now)
    create_time = db.Column(db.DateTime, default=datetime.datetime.now)

